<?php

namespace Plugins\AdminBasic\Requests;

use App\Requests\AbstractRequest;
use Hyperf\Validation\Rule;


/**
 * 路由菜单验证器
 */
class BasicRouteRequest extends AbstractRequest
{


    public function allRules(): array
    {
        return [
            'id' => ['required'],
            'pid' => ['required'],
            'type' => ['required'],
            'open_type' => ['required'],
            'title' => ['required'],
            'icon' => ['required'],
            'route' => ['required'],
            'power_route' => ['required'],
            'weigh' => ['required']
        ];
    }

    public function attributes(): array
    {
        return [
            'id' => 'ID',
            'pid' => '父级',
            'type' => '类型',
            'open_type' => '打开类型',
            'title' => '标题',
            'icon' => '图标',
            'route' => '路由',
            'power_route' => '权限路由',
            'weigh' => '排序'
        ];
    }

    public function updateScene(): array
    {
        return ['id', 'route', 'type'];
    }

    public function storeScene(): array
    {
        return ['route', 'type'];
    }

    public function destroyScene(): array
    {
        return [
            'data' => 'array'
        ];
    }
}